package com.example.demo.config;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class test {
    public static void main(String[] args) {
        Connection conn = null;
        try {
            // db参数是你的数据库文件的路径，如果文件不存在，SQLite会创建一个新的数据库
            String url = "jdbc:sqlite:db.sqlite";
            // 创建一个数据库连接
            conn = DriverManager.getConnection(url);

            Statement stmt = conn.createStatement();
            String sql2 = "CREATE TABLE IF NOT EXISTS purchase_apply_order (\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	applyDepartment text,\n"
                    + "	applicant text,\n"
                    + "	applyPhone text,\n"
                    + "	applyEmail text,\n"
                    + "	goods text,\n"
                    + "	goodsModel text,\n"
                    + "	goodsNumber text,\n"
                    + "	goodsPrice text,\n"
                    + "	generalBudget text,\n"
                    + "	purchasePurpose text,\n"
                    + "	allocation text,\n"
                    + "	deliveryTime text,\n"
                    + "	installDemand text,\n"
                    + "	checkStandard text,\n"
                    + "	identifyCode text,\n"
                    + "	trainingId text,\n"
                    + "	userId text \n"
                    + ");";
            String sql3 = "CREATE TABLE IF NOT EXISTS tv_info (\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	productModel text,\n"
                    + "	productName text,\n"
                    + "	usb2Number text,\n"
                    + "	usb3Number text,\n"
                    + "	HDMI21Number text,\n"
                    + " HDMI20Number text,\n"
                    + " lcdModel text,\n"
                    + " productIdCode text,\n"
                    + " productPrice text\n"
                    + ");";
            String sql4 = "CREATE TABLE IF NOT EXISTS lcd_info (\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	productModel text,\n"
                    + "	resolution text,\n"
                    + "	technology text,\n"
                    + "	refreshRate text,\n"
                    + "	colorGamut text,\n"
                    + "	angleView text,\n"
                    + "	contrastRatio text,\n"
                    + "	productIdCode text \n"
                    + ");";
            String sql5 = "CREATE TABLE IF NOT EXISTS purchase_order (\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	orderNumber text,\n"
                    + "	orderTime text,\n"
                    + " productModel text,\n"
                    + " goodsPrice text,\n"
                    + " goodsNumber text,\n"
                    + " totalPrice text,\n"
                    + " companyName text,\n"
                    + " companyAddress text,\n"
                    + " ContactsName text,\n"
                    + " contactsPhone text,\n"
                    + " contactsEmail text,\n"
                    + " deliveryTime text,\n"
                    + "	installDemand text,\n"
                    + "	checkStandard text,\n"
                    + "	supplierCompany text,\n"
                    + "	supplierCompanyAddress text,\n"
                    + "	supplierCompanyContacts text,\n"
                    + "	supplierCompanyPhone text,\n"
                    + "	supplierCompanyEmail text,\n"
                    + "	isPayment text,\n"
                    + "	isSignBuy text,\n"
                    + "	isSignSeller text,\n"
                    + "	identifyCode text,\n"
                    + "	isPart text,\n"
                    + "	orderState text,\n"
                    + "	trainingId text,\n"
                    + "	userId text \n"
                    + ");";
            String sql6 = "CREATE TABLE IF NOT EXISTS produce_plan(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	planNumber text,\n"
                    + "	orderNumber text,\n"
                    + "	produceTime text,\n"
                    + "	finishTime text,\n"
                    + "	produceWorkshop text, \n"
                    + "	identifyCode text, \n"
                    + "	trainingId text,\n"
                    + "	userId text \n"
                    + ");";

//            String sql7 = "CREATE TABLE IF NOT EXISTS coding_rules (\n"
//                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
//                    + "	ruleName text,\n"
//                    + "	batchNum text,\n"
//                    + "	serialNum text,\n"
//                    + "	randomNum text,\n"
//                    + " isolate text,\n"
//                    + "	appId text,\n"
//                    + " trainingId text,\n"
//                    + " userId text\n"
//                    + ");";
//            String sql8 = "CREATE TABLE IF NOT EXISTS code_assignment_rules (\n"
//                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
//                    + "	ruleName text,\n"
//                    + "	codingId Integer,\n"
//                    + "	ruleType text,\n"
//                    + "	appId text,\n"
//                    + " trainingId text,\n"
//                    + " userId text\n"
//                    + ");";
//            String sql9 = "CREATE TABLE IF NOT EXISTS logistics_order(\n"
//                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
//                    + "	logisticsNumber text,\n"
//                    + "	identifyCode text,\n"
//                    + "	orderNumber text,\n"
//                    + "	trainingId text,\n"
//                    + "	userId text \n"
//                    + ");";
            String sql10 = "CREATE TABLE IF NOT EXISTS logistics_order(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	logisticsNumber text,\n"
                    + "	identifyCode text,\n"
                    + "	orderClass text,\n"
                    + "	shipper text,\n"
                    + "	shipperPhone text,\n"
                    + "	shipperAddress text,\n"
                    + "	recipient text,\n"
                    + "	recipientPhone text,\n"
                    + "	recipientAddress text,\n"
                    + "	goodsInfo text,\n"
                    + "	goodsNumber text,\n"
                    + "	shipperTime text,\n"
                    + "	orderState text,\n"
                    + "	trainingId text,\n"
                    + "	userId text \n"
                    + ");";
            String sql11 = "CREATE TABLE IF NOT EXISTS dispatch_info(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	logisticsNumber text,\n"
                    + "	driver text,\n"
                    + "	driverPhone text,\n"
                    + "	carModel text,\n"
                    + "	licensePlate text,\n"
                    + "	recipientAddress text,\n"
                    + "	useTime text \n"
                    + ");";
            String sql12 = "CREATE TABLE IF NOT EXISTS material_plan(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	planNumber text,\n"
                    + "	identifyCode text,\n"
                    + "	materialInfo text \n"
                    + ");";
            String sql13 = "CREATE TABLE IF NOT EXISTS delivery_order(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	deliveryUnit text,\n"
                    + "	productName text,\n"
                    + "	productNumber text,\n"
                    + "	outNumber text,\n"
                    + "	packModel text,\n"
                    + "	packName text,\n"
                    + "	packNumber text,\n"
                    + "	identifys text,\n"
                    + "	trainingId text,\n"
                    + "	userId text \n"
                    + ");";
            String sql14 = "CREATE TABLE IF NOT EXISTS serial_number(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	serialNumber text,\n"
                    + "	updateTime text,\n"
                    + "	type text \n"
                    + ");";
            String sql15 = "CREATE TABLE IF NOT EXISTS driver_info(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	driverName text,\n"
                    + "	driverPhone text,\n"
                    + "	driverCar text,\n"
                    + "	licensePlate text \n"
                    + ");";
            String sql16 = "CREATE TABLE IF NOT EXISTS product_store(\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	storeNumber text,\n"
                    + "	identifyCode text,\n"
                    + "	storeTime text,\n"
                    + "	supplier text,\n"
                    + "	storeType text,\n"
                    + "	creator text,\n"
                    + "	reviewer text,\n"
                    + "	opinion text, \n"
                    + "	orderNumber text \n"
                    + ");";
            String sql17 = "CREATE TABLE IF NOT EXISTS custom_rules (\n"
                    + "	id integer PRIMARY KEY AUTOINCREMENT,\n"
                    + "	ruleId Integer,\n"
                    + "	ruleName text,\n"
                    + "	ruleType text,\n"
                    + "	ruleClass text,\n"
                    + "	rule text,\n"
                    + "	ruleDesc text,\n"
                    + "	appId text,\n"
                    + " trainingId text,\n"
                    + " userId text\n"
                    + ");";
//            stmt.execute(sql2);
//            stmt.execute(sql3);
//            stmt.execute(sql4);
//            stmt.execute(sql5);
//            stmt.execute(sql6);
            //stmt.execute(sql9);
            //stmt.execute(sql10);
            //stmt.execute(sql11);
            //stmt.execute(sql12);
//            stmt.execute(sql13);
//            stmt.execute(sql14);
            //stmt.execute(sql15);
            stmt.execute(sql17);
//
//            String sql = "UPDATE code_assignment_rules SET id = 0 WHERE name = 'your_table';";
//            stmt.execute(sql);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
            }
        }

    }

}
